#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
  int i,j,m,n;
  //char **p;
  while(~scanf("%d %d",&m,&n))
  {
    double ave[9999]={0},sum=0;
    int **p = (int **)calloc(m,sizeof(int *));
    for (int i = 0; i < m; i++)
    {
		  p[i] = (int *)calloc(n,sizeof(int));
	  }
    for (i = 0; i < m; i++)
      for (j = 0; j < n; j++)
        scanf("%d", &p[i][j]);
    for (j = 0; j < n; j++)
    {
      for (i = 0; i < m; i++)
      {
        ave[j] = ave[j] + p[i][j];
        sum = sum + p[i][j];
      }
      ave[j] = ave[j] / m;
      printf("%.2lf ", ave[j]);
    }
    printf("\n");
    ave[n] = sum / (m * n) * 1.0;
    printf("%.2lf\n",ave[n]);
    for (int i = 0; i < m; ++i)
	free(p[i]);
    free(p);
  }
    return 0;
}